{include file="public/header" /}
<link rel="stylesheet" type="text/css" href="/static/admin/webupload/webuploader.css">
<link rel="stylesheet" type="text/css" href="/static/admin/webupload/style.css">
<style>
.layui-form-pane .layui-form-label{width: 130px;}
.layui-form-pane .layui-input-block{
        margin-left: 130px;
}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>院系设置</h5>
                </div>
                <div class="ibox-content">
					<form id="form" method="post" class="layui-form layui-form-pane" action="{:url('school/import')}">
				
						
                        <div class="form-group pdf_type">
                            <label class="col-sm-3 control-label">excle文件(.xlsx)：</label>
                            <div class="input-group col-sm-4">
                                <input type="text" id="data_photo" style="width:300px;" name="file_url">
                                <div id="fileList" class="uploader-list" style="float:right"></div>
                                <div id="imgPicker" style="float:left">选择文件</div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;&nbsp;
                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                            </div>
                        </div>
					</form>

                </div>
            </div>

        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript" src="/static/admin/js/select2/select2.js"></script>
<link href="/static/admin/js/select2/css/select2.min.css?20191202" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/static/admin/webupload/webuploader.min.js"></script>

<script type="text/javascript">
	
	
	var $list = $('#fileList');
	var uploader = WebUploader.create({

		auto: true,// 选完文件后，是否自动上传。
		swf: '/static/admin/webupload/Uploader.swf',// swf文件路径
		server: "{:url('Upload/upload_excle')}",// 文件接收服务端。
		duplicate :true,// 重复上传图片，true为可重复false为不可重复
		pick: '#imgPicker',// 选择文件的按钮。可选。

		accept: {
			title: 'Images',
			extensions: 'xlsx',
			mimeTypes: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
		},

		'onUploadSuccess': function(file, data, response) {
			$("#data_photo").val(data.data.src);
		}
	});
    uploader.on( 'fileQueued', function( file ) {
        $list.html( '<div id="' + file.id + '" class="item">' +
            '<h4 class="info">' + file.name + '</h4>' +
            '<p class="state">正在上传...</p>' +
            '</div>' );
    });

    // 文件上传成功
    uploader.on( 'uploadSuccess', function( file ) {
        $( '#'+file.id ).find('p.state').text('上传成功！');
    });

    // 文件上传失败，显示上传出错。
    uploader.on( 'uploadError', function( file ) {
        $( '#'+file.id ).find('p.state').text('上传出错!');
    });
	
		
		
		
    //提交
    $(function(){
        $('#formEdit').ajaxForm({
            beforeSubmit: checkForm, 
            success: complete, 
            dataType: 'json'
        });
        
        function checkForm(){
            
        }


        function complete(data){
            if(data.code==1){
                layer.msg(data.msg, {icon: 6,time:1500,shade: 0.1}, function(index){
                    window.location.href="{:url('school/index')}";
                });
            }else{
                layer.msg(data.msg, {icon: 5,time:1500,shade: 0.1});
                return false;   
            }
        }
     
    });

</script>
</body>
</html>